/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * ModificarUsuario2.java
 *
 * Created on 31-ago-2011, 16:18:05
 */
package Ventanas;

import DataTypes.DataUsuario;
import Objetos.PropiedadesIP;
import Proxies.CtrlUsuariosWS;
import Proxies.CtrlUsuariosWSService;
import Proxies.EnumVisibilidad;
import estactrabajo.Transformador;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Calendar;
import java.util.Date;
import java.util.Iterator;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import javax.swing.RowFilter;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;
import javax.swing.table.TableRowSorter;
import javax.xml.namespace.QName;

/**
 *
 * @author jota
 */
public class ModificarUsuario2 extends javax.swing.JFrame {

    
    CtrlUsuariosWS modUsu;
    Proxies.DataUsuario du;
    /** Creates new form ModificarUsuario2 */
    public ModificarUsuario2() {
        initComponents();
        
        PropiedadesIP props = PropiedadesIP.getInstance();
        String IP = props.getServidorCentralIP();
        URL dirUsr = null;
        try {
            dirUsr = new URL(IP + "CtrlUsuarios?wsdl");
        } catch (MalformedURLException ex) {
            Logger.getLogger(ModificarUsuario2.class.getName()).log(Level.SEVERE, null, ex);
        }
        QName qNaUsr = new QName("http://WebServices/", "CtrlUsuariosWSService");
        modUsu = new CtrlUsuariosWSService(dirUsr, qNaUsr).getCtrlUsuariosWSPort();
        
        Object [] fila = new Object[3];
        Iterator<Proxies.DataUsuario> itera = modUsu.listaUsuarios().getItem().iterator();
        Proxies.DataUsuario usr;
        DefaultTableModel model = (DefaultTableModel) Table_buscarUsr.getModel();
                 
        while (itera.hasNext()){
            usr = itera.next();
            fila[0] = usr.getNombre();
            fila[1] = usr.getNick();
            fila[2] = usr.getCorreo();
            model.addRow(fila);
        }
        Table_buscarUsr.setRowSelectionInterval(0, 0);
        
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel2 = new javax.swing.JPanel();
        vPass = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        vEmail = new javax.swing.JTextField();
        vImagen = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jButton1 = new javax.swing.JButton();
        vPais = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        vNick = new javax.swing.JTextField();
        jLabel11 = new javax.swing.JLabel();
        vNombre = new javax.swing.JTextField();
        jLabel12 = new javax.swing.JLabel();
        vSexo = new javax.swing.JComboBox();
        vVisivilidad = new javax.swing.JComboBox();
        jLabel13 = new javax.swing.JLabel();
        vCiudad = new javax.swing.JTextField();
        jCalendarButton1 = new net.sourceforge.jcalendarbutton.JCalendarButton();
        jCheckBox_notificaciones = new javax.swing.JCheckBox();
        jLabel10 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        Table_buscarUsr = new javax.swing.JTable();
        jLabel1 = new javax.swing.JLabel();
        TextField_BuscarUsuario = new javax.swing.JTextField();
        jButton2 = new javax.swing.JButton();

        jLabel3.setText("E-Mail");

        jLabel5.setText("Imagen");

        jLabel4.setText("Contraseña");

        jLabel9.setText("Nivel de Visibilidad");

        jLabel8.setText("Pais");

        jLabel7.setText("Sexo");

        jButton1.setText("Modificar");
        jButton1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jButton1MouseClicked(evt);
            }
        });
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jLabel2.setText("Nick");

        jLabel6.setText("Fecha de nacimiento");

        jLabel11.setText("Nombre");

        jLabel12.setText("RED - Modificar Usuario");

        vSexo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "M", "F" }));
        vSexo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                vSexoActionPerformed(evt);
            }
        });

        vVisivilidad.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "PUBLICO", "PARCIAL", "PRIVADO" }));

        jLabel13.setText("Ciudad");

        jCalendarButton1.setText("Fecha");
        jCalendarButton1.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                jCalendarButton1StateChanged(evt);
            }
        });
        jCalendarButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCalendarButton1ActionPerformed(evt);
            }
        });
        jCalendarButton1.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                jCalendarButton1PropertyChange(evt);
            }
        });

        jCheckBox_notificaciones.setText("Enviar notificaciones al usuario");

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                        .addGap(64, 64, 64)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                                    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                        .addComponent(jLabel4)
                                        .addComponent(jLabel11))
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))
                                .addGroup(jPanel2Layout.createSequentialGroup()
                                    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                        .addComponent(jLabel7)
                                        .addComponent(jLabel8)
                                        .addComponent(jLabel13)
                                        .addComponent(jLabel9)
                                        .addComponent(jLabel6))
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)))
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addComponent(jLabel5)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED))
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(jLabel3)
                                    .addComponent(jLabel2))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)))
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(vSexo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                .addComponent(vCiudad, javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(vPais, javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(vImagen, javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(vPass, javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(vEmail, javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(vNick, javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel2Layout.createSequentialGroup()
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jButton1))
                                .addComponent(vNombre, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 232, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(vVisivilidad, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jCalendarButton1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jCheckBox_notificaciones))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(51, 51, 51)
                        .addComponent(jLabel12)))
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel12)
                .addGap(18, 18, 18)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(vNombre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel11))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(vNick, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel2))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(vEmail, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel3))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel4)
                    .addComponent(vPass, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(vImagen, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel5))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel6)
                    .addComponent(jCalendarButton1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel7)
                    .addComponent(vSexo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(vPais, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel8))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel13)
                    .addComponent(vCiudad, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(vVisivilidad, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel9))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jCheckBox_notificaciones)
                .addGap(15, 15, 15)
                .addComponent(jButton1)
                .addGap(38, 38, 38))
        );

        jLabel10.setFont(new java.awt.Font("Times New Roman", 0, 18));
        jLabel10.setText("RED - Modificar  Usuario");

        Table_buscarUsr.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Nombre", "Nick", "Correo"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                false, false, false
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jScrollPane1.setViewportView(Table_buscarUsr);

        jLabel1.setFont(new java.awt.Font("Tahoma", 0, 12));
        jLabel1.setText("Buscar");

        TextField_BuscarUsuario.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                TextField_BuscarUsuarioKeyReleased(evt);
            }
        });

        jButton2.setText("Elegir");
        jButton2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jButton2MouseClicked(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(34, 34, 34)
                        .addComponent(jLabel10))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(52, 52, 52)
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 306, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(91, 91, 91)
                        .addComponent(jLabel1)
                        .addGap(18, 18, 18)
                        .addComponent(TextField_BuscarUsuario, javax.swing.GroupLayout.PREFERRED_SIZE, 111, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(114, 114, 114)
                        .addComponent(jButton2)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, 422, Short.MAX_VALUE)
                .addGap(22, 22, 22))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(48, 48, 48)
                .addComponent(jLabel10)
                .addGap(63, 63, 63)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(TextField_BuscarUsuario, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel1))
                .addGap(18, 18, 18)
                .addComponent(jButton2)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 28, Short.MAX_VALUE)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(111, 111, 111))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, 402, Short.MAX_VALUE)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton1MouseClicked
// TODO add your handling code here:
    
    PropiedadesIP props = PropiedadesIP.getInstance();
    String IP = props.getServidorCentralIP();
    URL dirUsr = null;
    try {
        dirUsr = new URL(IP + "CtrlUsuarios?wsdl");
    } catch (MalformedURLException ex) {
        Logger.getLogger(Amistades.class.getName()).log(Level.SEVERE, null, ex);
    }
    QName qNaUsr = new QName("http://WebServices/", "CtrlUsuariosWSService");
    CtrlUsuariosWS ctrlUsr = new CtrlUsuariosWSService(dirUsr, qNaUsr).getCtrlUsuariosWSPort();
    
    Proxies.DataUsuario DatosUsr = ctrlUsr.getUsuario(du.getCorreo());
    
    EnumVisibilidad enumNiv = null;
    String nivel = vVisivilidad.getSelectedItem().toString();
    
    if ("PUBLICO".equals(nivel))
        enumNiv = EnumVisibilidad.PUBLICO;
    if ("PRIVADO".equals(nivel))
        enumNiv = EnumVisibilidad.PRIVADO;
    if ("PARCIAL".equals(nivel))
        enumNiv = EnumVisibilidad.PARCIAL;
    
    Date d = jCalendarButton1.getTargetDate();
    Calendar cal = Calendar.getInstance();
    cal.setTime(d);

    DataUsuario de = new DataUsuario(vEmail.getText(),vNombre.getText(),vNick.getText(),vPass.getText(), cal, vSexo.getSelectedItem().toString(),vCiudad.getText(),vPais.getText(),false,enumNiv,vImagen.getText(), jCheckBox_notificaciones.isSelected(), DatosUsr.isCambioPass());
    de.setNotificar(jCheckBox_notificaciones.isSelected());
    
    Transformador  tra = new Transformador();
    Proxies.DataUsuario dt = tra.changeUsuario(de);
    
    modUsu.modificarUsuario(dt,du.getCorreo());
    JOptionPane.showMessageDialog(null, "Se modifico correctamente");
    
    Object[] fila = new Object[3];
    Iterator<Proxies.DataUsuario> itera = modUsu.listaUsuarios().getItem().iterator();
    Proxies.DataUsuario usr;
    DefaultTableModel model = (DefaultTableModel) Table_buscarUsr.getModel();
    model.setRowCount(0);
    while (itera.hasNext()) {
        usr = itera.next();
        fila[0] = usr.getNombre();
        fila[1] = usr.getNick();
        fila[2] = usr.getCorreo();
        model.addRow(fila);
    }

}//GEN-LAST:event_jButton1MouseClicked

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_jButton1ActionPerformed

private void vSexoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_vSexoActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_vSexoActionPerformed

private void jButton2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton2MouseClicked
// TODO add your handling code here:
    
    String usu;
    if(Table_buscarUsr.getRowCount()!=0)
    {
    if(Table_buscarUsr.getSelectedRow()==-1)
        usu = Table_buscarUsr.getValueAt(0, 2).toString();
    else 
        usu = Table_buscarUsr.getValueAt(Table_buscarUsr.getSelectedRow(),2).toString();
    
    
    if (modUsu.containsKey(usu)) {
       
        
        du = modUsu.getUsuario(usu);
        vNombre.setText(du.getNombre());
        vNick.setText(du.getNick());
        vEmail.setText(du.getCorreo());
        vPais.setText(du.getPais());
        vPass.setText(du.getContrasena());
        Date d = du.getFechaNac().toGregorianCalendar().getTime();
        
        jCalendarButton1.setTargetDate(d);
        vSexo.setSelectedItem(du.getSexo());
        vCiudad.setText(du.getCiudad());
        vImagen.setText(du.getImagen());
        jCheckBox_notificaciones.setSelected(du.isNotificar());
        vVisivilidad.setSelectedItem(du.getNivelVisibilidad().toString());
      }
    else 
        JOptionPane.showMessageDialog(null, "No se encuentra en el Sistema");
    }
    
}//GEN-LAST:event_jButton2MouseClicked

private void TextField_BuscarUsuarioKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_TextField_BuscarUsuarioKeyReleased
// TODO add your handling code here:
    
        TableModel modelo = Table_buscarUsr.getModel();
        final TableRowSorter<TableModel> sorter = new TableRowSorter<TableModel>(modelo);
        Table_buscarUsr.setRowSorter(sorter);
        String text = TextField_BuscarUsuario.getText();
        if (text.length() == 0) {
          sorter.setRowFilter(null);
        } else {
          sorter.setRowFilter(RowFilter.regexFilter(text));
        }
//        Table_buscarUsr.setRowSelectionInterval(0, 0);
    
    
}//GEN-LAST:event_TextField_BuscarUsuarioKeyReleased

    private void jCalendarButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCalendarButton1ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jCalendarButton1ActionPerformed

    private void jCalendarButton1StateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jCalendarButton1StateChanged
        // TODO add your handling code here:
        
    }//GEN-LAST:event_jCalendarButton1StateChanged

    private void jCalendarButton1PropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_jCalendarButton1PropertyChange
        // TODO add your handling code here:
        
    }//GEN-LAST:event_jCalendarButton1PropertyChange

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(ModificarUsuario2.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(ModificarUsuario2.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(ModificarUsuario2.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(ModificarUsuario2.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new ModificarUsuario2().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTable Table_buscarUsr;
    private javax.swing.JTextField TextField_BuscarUsuario;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private net.sourceforge.jcalendarbutton.JCalendarButton jCalendarButton1;
    private javax.swing.JCheckBox jCheckBox_notificaciones;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTextField vCiudad;
    private javax.swing.JTextField vEmail;
    private javax.swing.JTextField vImagen;
    private javax.swing.JTextField vNick;
    private javax.swing.JTextField vNombre;
    private javax.swing.JTextField vPais;
    private javax.swing.JTextField vPass;
    private javax.swing.JComboBox vSexo;
    private javax.swing.JComboBox vVisivilidad;
    // End of variables declaration//GEN-END:variables
}
